package com.nb.dp.strategy.v4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * word处理
 * @author lihaoyang6
 * @date 2023年11月16日 14:35
 */
@Component
public class WordHandler {

    private Map<String, Handler> typeToHandler = new HashMap<String, Handler>();

    @Autowired
    private WordHandler(List<Handler> handlers){
        handlers.forEach(handler -> {
            typeToHandler.put(handler.getType(), handler);
        });
    }

    public Handler getHandler(String type){
        return typeToHandler.get(type);
    }

}
